{layout name="layout" /}

<form class="layui-form" action="addadminmsgrun.html" style="margin-top: 50px;" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label" style="width:100px;">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题"
                class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
            <select name="type" lay-verify="required">
                <option value=""></option>
                <option value="1">最新新闻</option>
                <option value="2">优惠政策</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label" style="width:100px;">普通文本域</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="desc"></textarea>
        </div>
    </div>
    
    <div class="layui-form-item" style="margin-top: 50px;">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use('form', function () {
        var form = layui.form;
    });
    $(".newspic").click(function () {
        $(this).next('input').click();
    });
    function showPic(data) {
        if (data.files && data.files[0]) {
            var reader = new FileReader();
            reader.readAsDataURL(data.files[0]);
            reader.onload = function (evt) {
                data.parentNode.childNodes[1].childNodes[1].src = evt.target.result;
            }
        }
    }

</script>